package com.mybpm.core.instance


import com.mybpm.core.definition.Transition
import grails.compiler.GrailsCompileStatic
import groovy.transform.ToString

/**
 * 已阅任务实例
 */
@GrailsCompileStatic
@ToString(includes = 'id,title', includeNames = true, includePackage = false)
class ReadTask {
    Long id
    /** 环节定义id */
    String nid
    /** 环节显示名称 */
    String displayName
    /** 待阅类型 */
    String type
    /** 任务标题 */
    String title
    /** 前置任务id */
    Long formTaskId
    /** 办理人id */
    String actorId
    /** 办理人姓名 */
    String actorName

    Date dateCreated;
    Date lastUpdated;

    static belongsTo = [processInstance: ProcessInstance]
    static hasMany = [transitions: Transition]
//    static hasMany = [toReadTasks: ToReadTask, readTasks: ReadTask]

    static constraints = {
        nid nullable: false, blank: false, length: 200
        displayName nullable: true, length: 100
        type nullable: true, length: 50
        title nullable: true, length: 200
        formTaskId nullable: true, length: 100
        actorId nullable: true, length: 100
        actorName nullable: true, length: 100
    }

    static mapping = {
        table 'bpm_i_task_read'
        id generator: 'com.mybpm.core.utils.ReadTaskIdGenerator'
        version false
    }

}
